package com.ssy.lingxi.platform.template.service.repository;

import com.ssy.lingxi.platform.template.service.entity.adorn.Advert;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AdvertRepository extends JpaRepository<Advert, Long> {

    List<Advert> findByTemplateIdAndCategoryIdAndType(Long templateId, Long categoryId, Integer type);

    List<Advert> findByTemplateIdAndTypeAndMemberIdAndRoleId(Long templateId, Integer type, Long memberId, Long roleId);

    List<Advert> findByTemplateIdAndTypeAndMemberId(Long templateId, Integer type, Long memberId);

    void deleteByTemplateIdAndCategoryIdAndType(Long templateId, Long categoryId, Integer type);

    void deleteByTemplateIdAndTypeAndMemberIdAndRoleId(Long templateId, Integer type, Long memberId, Long roleId);
}
